package com.cjq.auth.handle;

import com.cjq.auth.exception.ServiceException;
import com.cjq.common.result.Result;
import lombok.extern.log4j.Log4j2;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * 全局统一异常
 */
@RestControllerAdvice
@Log4j2
public class ServiceHandle {
    @ExceptionHandler
    public Result serviceException(ServiceException serviceException){
        log.info("错误信息：{}",serviceException.getMessage());
        return Result.error(serviceException.getMessage());
    }
}
